package com.zxy.paycenter.common.config;

import com.alipay.api.DefaultAlipayClient;

import java.util.Properties;

/**
 * @author zxy
 */
public class DefaultAlipayClientFactory {
    private DefaultAlipayClientFactory() {
    }

    private static DefaultAlipayClient instance;

    public static synchronized DefaultAlipayClient getInstance(Properties properties) {
        if (instance == null) {
            instance = new DefaultAlipayClient(
                    properties.getProperty("gatewayUrl"),
                    properties.getProperty("appId"),
                    properties.getProperty("privateKey"),
                    properties.getProperty("format"),
                    properties.getProperty("charset"),
                    properties.getProperty("alipayPublicKey"),
                    properties.getProperty("signType"));
        }
        return instance;
    }
}
